package no.ntnu.fp.gui.listeners;

import no.ntnu.fp.gui.events.RequestCalendarForEmployeeEvent;
import no.ntnu.fp.services.AppointmentService;
import no.ntnu.fp.services.MeetingService;

public class RequestCalendarForEmployeeListener implements
		GuiListener<RequestCalendarForEmployeeEvent> {

	private final AppointmentService appointmentService;
	private final MeetingService meetingService;
	
	public RequestCalendarForEmployeeListener(
			AppointmentService appointmentService, MeetingService meetingService) {
		this.appointmentService = appointmentService;
		this.meetingService = meetingService;
	}

	@Override
	public void handleEvent(RequestCalendarForEmployeeEvent evt) {
		appointmentService.fetchAppointmentsForEmployee(evt.getEmployee());
		meetingService.fetchMeetingsForEmployee(evt.getEmployee());
	}

	@Override
	public boolean isLongRunningListener() {
		return false;
	}

}
